package com.hk.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hk.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**   条件分页查询*/
    List<User> list(@Param("userName") String userName,
                    @Param("phonenumber") String phonenumber,
                    @Param("status") String status,
                    @Param("beginTime") String beginTime,
                    @Param("endTime") String endTime,
                    @Param("pageNum") Integer pageNum,
                    @Param("pageSize") Integer pageSize);

    int countList(@Param("userName") String userName,
                  @Param("phonenumber") String phonenumber,
                  @Param("status") String status,
                  @Param("beginTime") String beginTime,
                  @Param("endTime") String endTime);

    /**   根据id查询*/
    User selectById(Integer userId);

    /**   新增用户*/
    int insertUser(User user);

    /**   删除*/
    @Delete("delete from user where user_id = #{id}")
    void delete(Integer userId);

    /**   修改用户信息*/
    void updateUserById(User user);


    List<User> selectByDeptId(Integer deptId);
}
